import { CylinderGeometry, Mesh, MeshPhongMaterial } from "three";
import Three, { TweenType } from "./index";
import { Tween } from "@tweenjs/tween.js";

// Amf 实例化
class Amf extends Three {
  // 初始化
  constructor(dom: HTMLElement, openGUI: boolean = false) {
    super(dom, openGUI);
  }

  // 添加模型
  // 添加圆柱
  addClub() {
    const club = new Mesh(
      new CylinderGeometry(0, 2, 10, 32),
      new MeshPhongMaterial({ color: 0x00ff00 }),
    );
    club.rotation.x = Math.PI / 2;
    club.up.set(0, 0, 1);
    const tween: TweenType = new Tween(club.position)
      .delay(2000)
      .to({ y: 20, z: 10 }, 1000)
      .start();

    this.animations.add(tween);
    this.scene.add(club);
  }
}

export default Amf;
